from threading import Thread, Lock
from time import sleep


class Account(object):

    def __init__(self):
        self.balance = 0
        self.lock = Lock()

    def deposit(self, money):
        with self.lock:
            new_balance = self.balance + money
            sleep(0.01)
            self.balance = new_balance


account = Account()
threads = []
for _ in range(100):
    t = Thread(target=account.deposit, args=(1, ))
    threads.append(t)
    t.start()
for t in threads:
    t.join()
print(account.balance)
